#include <iostream>
#include <cmath>
#include <unordered_map>
#include <string>

bool is_prime(int n) {
    if (n <= 1) {
        return false;
    }
    for (int i = 2; i <= static_cast<int>(std::sqrt(n)) + 1; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int next_prime(int n) {
    if (n <= 1) {
        return 2;
    }
    int prime = n;
    bool found = false;
    while (!found) {
        prime += 1;
        if (is_prime(prime)) {
            found = true;
        }
    }
    return prime;
}

std::unordered_map<std::string, std::string> words_to_numbers = {
    {"one", "1"}, {"two", "2"}, {"three", "3"}, {"four", "4"}, {"five", "5"},
    {"six", "6"}, {"seven", "7"}, {"eight", "8"}, {"nine", "9"}, {"zero", "0"}
};

int main() {
    std::string input_str;
    std::getline(std::cin, input_str);
    std::string number_str = "";
    std::string word;
    std::istringstream iss(input_str);
    while (iss >> word) {
        std::transform(word.begin(), word.end(), word.begin(), ::tolower);
        if (words_to_numbers.find(word) != words_to_numbers.end()) {
            number_str += words_to_numbers[word];
        } else {
            std::cout << "Wrong input" << std::endl;
            return 0;
        }
    }

    if (number_str.length() == 3 && std::all_of(number_str.begin(), number_str.end(), ::isdigit)) {
        int number = std::stoi(number_str);
        std::cout << next_prime(number) << std::endl;
    } else {
        std::cout << std::endl;
    }

    return 0;
}
